<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<?php
//1.连接数据库
//$longer = mysql_connect("localhost",'root','1234');   
//if(!$longer ){   //判断是否连接成功
//	echo "fail" ;
// }else echo "good !";
//2.选择数据库s
//mysql_select_db("liraryoa");   
//3.sql查询
header('Content-Type:text/html;charset=UTF-8');
require('mysql.php');
$usernum = trim($_POST["usernum"]);
//var_dump($usernum);
//echo "<br/>";
$station = trim($_POST["station"]);
//var_dump($station);
//echo "<br/>";
$time =$_POST["time"];
//var_dump($time);
//echo "<br/>";
$reason = trim($_POST["reason"]);
//var_dump($reason);
//echo "<br/>";
$total_time=null;
foreach($time as $n){
$total_time=$total_time.$n;
//	echo $n.") 成功<br />";
}
var_dump($total_time);
$sql = "insert into apply values ('$usernum','$station','$reason','$total_time','no')";    
mysql_query(" set names utf8");
$query = mysql_query($sql);
if($query){
	
echo  ("<script type='text/javascript'>alert('添加成功！');location.href='../view/Login.php';</script>");

	echo '提交成功! <a href="../view/Login.php">点击此处退出</a>'."<br/>";
	$url = "../view/Login.php";
	exit;
}else{
	echo '数据插入失败。';
}
// while ($row=mysql_fetch_row($res))   //$row是数组类型
// {
// 	foreach ($row as $key => $val)
// 		echo "$val"."<br/>";
// }
//释放资源,关闭连接	
mysql_close();
?>
</html>